--
-- Author: ping.wang
-- Date: 2019-03-26 14:49:17
--
-- WithTipsView
--

local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.WithTipsScene

function ClassRef:init()

	if self._data then
		self._ui.tips_txt:setString(self._data.msg)
	else
		self._ui.tips_txt:setString("")
	end


	self._ui.Button_queding:addClickEventListener(function()
		--是否要关闭游戏 以及上报要根据类型来
		if self._data then
			if self._data.type == 1 then
				--休息提醒 点击后上报
				app.channelAPI:WGReportPrajna(self._data.traceId)
			elseif self._data.type == 2 then
				--下线提醒 点击后上报且准备返回登陆界面
				app.channelAPI:WGReportPrajna(self._data.traceId)
				app.channelAPI:logout()
				app:relaunchApp(1)
			elseif self._data.type == 3 then
				app.channelAPI:WGOpenFullScreenWebViewWithJson(self._data.jsonStr)
			end
		end
		self:closeView()
	end)

	self:onCloseView(function()
		UIHandler:removePopupUiByKey("WithTipsView")
	end)
end


return ClassRef
